package cn.jingyuan.owl.web.oauth2.crypto;

import org.springframework.security.crypto.password.PasswordEncoder;

import java.util.Objects;

public class NoOpPasswordEncoder implements PasswordEncoder {

    public static final PasswordEncoder INSTANCE = new NoOpPasswordEncoder();

    private NoOpPasswordEncoder() { }

    public static PasswordEncoder getInstance() {
        return INSTANCE;
    }

    @Override
    public String encode(CharSequence charSequence) {
        return charSequence.toString();
    }

    @Override
    public boolean matches(CharSequence charSequence, String s) {
        return Objects.equals(charSequence.toString(), s);
    }

}
